package mirrormonkey.state.member.accessor;

import java.lang.reflect.Method;

import mirrormonkey.framework.entity.SyncEntity;

public class SetterWriteAccessor implements ValueWriteAccessor {

	public final Method setter;

	public SetterWriteAccessor(Method setter) {
		this.setter = setter;
	}

	@Override
	public void writeValue(SyncEntity entity, Object value) {
		try {
			setter.invoke(entity, value);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
	}

}
